package https

import (
	"gitee.com/lailonghui/vehicle-supervision-framework/pkg/auths"
	"github.com/Yamashou/gqlgenc/client"
	"net/http"
)

func AuthorizationOption() client.HTTPRequestOption {
	return func(req *http.Request) {
		token, ok := req.Context().Value(auths.TOKEN_KEY).(*string)
		if !ok {
			return
		}
		if token == nil {
			return
		}
		req.Header.Add(auths.TOKEN_HEADER, *token)
	}
}
